package org.mm.service.impl;

import java.util.List;

import org.mm.model.Patient;
import org.mm.model.Sensor;
import org.mm.repository.SensorRepository;
import org.mm.service.SensorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * SensorServiceImpl
 *
 * @author Marco Traversari
 * @version $Revision: $ $Date: $ $Author: $
 */
@Service("sensorService")
public class SensorServiceImpl implements SensorService {

	@Autowired
	private SensorRepository sensorRepository;

	public List<Sensor> findByPatient(Patient patient) throws Exception {
		List<Sensor> sensors = sensorRepository.findByPatientId(patient.getPatientId());
		return sensors;
	}

	public Sensor findById(Long sensorId) throws Exception {
		return sensorRepository.findOne(sensorId);
	}

}
